﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace ProjectNocturnalFool
{
    class PartySelectScreen : MenuScreen
    {
        PartySelectPanel partySelectPanel;
        CharacterDisplayPanel characterDisplayPanel;

        public override void LoadContent()
        {
            base.LoadContent();
            topBanner.message = "Party Creation";            

            partySelectPanel = new PartySelectPanel();
            partySelectPanel.LoadContent();
            partySelectPanel.x = contentPanel.x;
            partySelectPanel.y = contentPanel.y;
            partySelectPanel.width = (contentPanel.width / 2) + 25;
            partySelectPanel.height = contentPanel.height;
            contentPanel.controls.Add(partySelectPanel);

            characterDisplayPanel = new CharacterDisplayPanel();
            characterDisplayPanel.LoadContent();
            characterDisplayPanel.x = contentPanel.x + partySelectPanel.width - 1;
            characterDisplayPanel.y = contentPanel.y;
            characterDisplayPanel.width = contentPanel.width - partySelectPanel.width + 1;
            characterDisplayPanel.height = contentPanel.height;
            contentPanel.controls.Add(characterDisplayPanel);
        }

        public override void HandleState()
        {
            base.HandleState();

            Tuple<string, int, int> match = updateStatus.Find(p => p.Item1 == typeof(PartyMemberPanel).Name);
            if (match != null)
            {
                characterDisplayPanel.displayCharacter = GameLogic.Instance.gameCharacterSession.charList[match.Item2];
                GameLogic.Instance.gameCharacterSession.editIndex = match.Item2;
            }
            else
                characterDisplayPanel.displayCharacter = null;



        }

    }
}
